<?php
	$CI =& get_instance();
	$CI->load->model('Model_career', 'model_career');

	$tree = $this->model_nav->fetchNav($node['pid']);
	$rows = $CI->model_career->browse('','','','','','is_important', 'DESC');
	$i = 0;
?>
<div class="left-2-col texture">
	<ul class="bullet_list">
		<?php foreach($tree as $item):
				$class = "";
				if($item['id'] == $node['id'])
					$class = "selected";
		?>
		<li class = "<?=$class?>">
			<a href="<?=site_url(array('c' => 'home','m' => 'index', 'nav'=>$item['id']))?>"><?=$item['nav_name']?></a>
			<?php 	$tree_1 =  $this->model_nav->fetchNav($item['id']);
					if(!empty($tree_1)){
			?>
				<ul>
				<?php foreach($tree_1 as $item_1):?>
					<li class=""><a href="<?=site_url(array('c' => 'home','m' => 'index', 'nav'=>$item_1['id']))?>" title="<?=htmlspecialchars($item_1['nav_name'])?>"><?=htmlspecialchars($item_1['nav_name'])?></a></li>
				<?php endforeach; ?>
				</ul>
			<?php	}?>
		</li>
		<?php endforeach; ?>
	</ul>
</div>
<div class="col_center" id="page_search">
	<h2><?= $node['nav_name'] ?></h2>
	<?php if(!empty($rows)):?>
	<?php foreach($rows as $row):
			if($row['is_important'])
				$class="vacancy_title";
			else
				$class="vacancy_title_small";
	?>
	<div class="content_vacancy" id="vacancy_<?=$row['id']?>">
		<?php if($row['is_important']):?>
		<span class="new_vacancy">NEW</span>
		<?php endif;?>
		<div class="<?=$class?>">
			<?=$row['title']?>
		</div>
		<div>
			<div><span class="vacancy_label"><?=lang('location')?>: </span><?=$row['location']?></div>
			<div><span class="vacancy_label"><?=lang('job-posting')?>: </span><?=$row['created_date']?></div>
			<div class="brief"><span class="vacancy_label"><?=lang('brief')?>: </span><?=$row['brief']?></div>
			<div class="vacancy_description">
				<?=$row['description']?>				
			</div>
			<div class="vacancy_option">
				<a class="item black" href="#" onclick="toogle_detail(<?=$row['id']?>); return false;"><span><?=$this->lang->line('Read more')?></span></a>
				<a class="item red" href="mailto:<?=$row['email']?>?subject=<?=$row['subject']?>"><span><?=$this->lang->line('Apply job')?></span></a>
			</div>
		</div>		
	</div>
	<?php $i++; ?>
	<?php endforeach; ?>
	<?php endif;?>
</div>
<div class="clearfix"></div>
<script language="JavaScript" type="text/javascript">
	function toogle_detail(id){
		$("#vacancy_"+id+" .brief").toggle('slow');
		$("#vacancy_"+id+" .vacancy_description").animate({height: 'toggle'},'slow');
	}	
</script>
